﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mighty.Common;

namespace Mighty.Brain
{
    public class PresentBrain : BasicBrain
    {
        public override Betting BettingTicEvent()
        {
            Betting betting = new Betting();
            betting.isPass = true;
            return betting;
        }

        public override HandedCard RoundTicEvent()
        {
            Round r = gameInfo.roundHistory[gameInfo.roundIdx];

            bool ace = false;
            foreach (RoundCard rc in r.cardStack)
            {
                if (rc == null) break;
                if (rc.number == 14) ace = true;
            }

            int minNumber = 14;
            int index = -1;
            for ( int i = 0 ; i < 10 ; i++ ) {
                HandedCard hc = gameInfo.myCards[i];
                if (hc.isPossible)
                {
                    if (hc.number < minNumber)
                    {
                        minNumber = hc.number;
                        index = i;
                    }
                }
            }
            if (ace&&index!=-1) return gameInfo.myCards[index];

            int[] a = new int[5];
            a[3] = 2;


            return null;
        }

    }
}
